package com.bwie.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 红记录表
 * @TableName tb_packet_record
 */
@TableName(value ="tb_packet_record")
@Data
@Document(indexName = "es_record",shards = 1,replicas = 0)
public class TbPacketRecord implements Serializable {
    /**
     * 记录id
     */
    @Id
    @Field(type = FieldType.Keyword)
    @TableId(type = IdType.AUTO)
    private Integer recordId;

    /**
     * 创建人
     */

    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8",shape = JsonFormat.Shape.STRING)
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    /**
     * 更新人
     */

    @TableField(fill = FieldFill.UPDATE)
    private String updatedBy;

    /**
     * 更新时间
     */

    @TableField(fill = FieldFill.UPDATE)
    private Date updatedTime;

    /**
     * 领取人iD
     */
    private Integer userId;

    /**
     * 红包金额
     */
    @Field(type = FieldType.Double)
    private Double packetAmount;


    private Integer policyId;

    @TableField(exist = false)
    private Long msgId;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String userMobile;
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String policyName;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8",shape = JsonFormat.Shape.STRING)
    private Date beginTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8",shape = JsonFormat.Shape.STRING)
    @TableField(exist = false)
    private Date endTime;

    @TableField(exist = false)
    private String typeId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}